
$('.form1').on('submit',e=>{
    e.preventDefault()

   info={
     username:  $('#exampleInput').val(),
    password : $('#exampleInputPassword1').val()
   }
   
    if (!info.username || !info.password) return alert('请完整输入用户名和密码')
    
    $.ajax({
       url:'http://localhost:8888/users/login' ,
       method: 'post', 
       data: info,
       success:res=>{
        if (res.code !== 1) {
            // errBox.style.display = 'block'
            return
        }
        window.localStorage.setItem('token', res.token)
        window.localStorage.setItem('id', res.user.id)
        window.location.href = './index.html'

       }
    })
})


